<template>
  <!-- <th-card title="其他"> -->
  <!-- <th-card title="附件"> -->
  <!-- <th-form-item label="内容" class="form-demandDesc" v-if="form.others">
    <text class="text">{{ form.others }}</text>
  </th-form-item> -->
  <!-- </th-card> -->
  <!-- <view style="background-color: white">
    <th-form-item
      label=""
      style="flex-direction: column; align-items: start"
      v-if="form.rdTaskFileEntity && form.rdTaskFileEntity.length"
    > -->
  <th-card title="附件" v-if="form.rdTaskFileEntity && form.rdTaskFileEntity.length">
    <view class="info-list">
      <view class="info-list-main">
        <view class="info-list-row">
          <!-- <view class="info-list-label">附件</view> -->
          <view class="info-list-value">
            <view style="display: flex; flex-direction: column">
              <view
                v-for="file in form.rdTaskFileEntity"
                :key="file.id"
                @click="previewFileHandle(file.fileUrl)"
                class="info-row-item"
              >
                {{ file.fileName }}
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </th-card>
  <template v-if="form.id && form.checkFlag == '1'">
    <assayReport :pid="form.id" :version="0"></assayReport>
  </template>
  <!-- </th-form-item> -->
  <!-- </view> -->
</template>
<script lang="tsx" setup>
// import assayReport from '@/pages/pm/assay-report/component/assayReport.vue';
import assayReport from './assayReport.vue';

const form = reactive({
  rdInformationDTO: [],
  rdCraftEntity: [],
  rdTaskFileEntity: [],
  others: '',
  checkFlag: '0',
  id: '',
});

const init = (row) => {
  form.rdInformationDTO = row.rdInformationDTO;
  form.rdCraftEntity = row.rdCraftEntity;
  form.rdTaskFileEntity = row.rdTaskFileEntity;
  form.others = row.others;
  form.checkFlag = row.checkFlag;
  form.id = row.id;
};

const previewFileHandle = (file) => {
  uni.navigateTo({
    url: '/pages/pm/preview-online?url=' + file,
  });
};

const previewWeb = (url) => {
  uni.navigateTo({
    url: '/pages/pm/preview-online?url=' + url + '&isWeb=1',
  });
};

defineExpose({
  init,
});
</script>

<style lang="scss" scoped>
.info-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0 24rpx;

  .info-list-main {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;

    // padding: 10rpx;
    // margin: 0 24rpx;

    // border: 1px solid #e3e3e3;
    border-radius: 8rpx;

    .info-list-row {
      display: flex;
      width: 100%;

      .info-list-label {
        width: 160rpx;
        margin-right: 12rpx;
        font-size: 28rpx;
        color: #808080;
      }

      .info-list-value {
        display: flex;
        flex: 1;
        align-items: center;
        width: 0;
        word-break: break-all;
        white-space: pre-line;
      }
    }
  }
}

.craft-row {
  display: flex;
  align-items: center;

  .craft-row-img-main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    width: 0;
  }
}

.craft-row-img {
  width: 240rpx;
  height: 240rpx;
}

.form-demandDesc {
  align-items: flex-start !important;

  .text {
    word-break: break-all;
  }
}

.info-row-item {
  // padding: 6rpx 0;
  // word-break: break-all;

  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 6rpx 0;
  color: blue;
  word-break: break-all;

  // border-bottom: 1px solid #f2f2f2;
}
</style>
